From 4a08e76b2b0d4a42ff3672367a165d92c8cb8786 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sat, 11 Nov 2000 00:34:47 +0000 Subject: [PATCH] Use g_file_open_tmp() (just added to GLib) instead of mkstemp() (or 2000-11-11 Tor Lillqvist * io-tiff.c (gdk_pixbuf__tiff_image_begin_load): Use g_file_open_tmp() (just added to GLib) instead of mkstemp() (or mktemp() and open()). * io-xpm.c (gdk_pixbuf__xpm_image_begin_load): Ditto. --- gdk-pixbuf/ChangeLog | 8 ++++++++ gdk-pixbuf/io-tiff.c | 15 ++------------- gdk-pixbuf/io-xpm.c | 5 ++--- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 3ce42c569f..ea9b49f81a 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,11 @@ +2000-11-11 Tor Lillqvist + + * io-tiff.c (gdk_pixbuf__tiff_image_begin_load): Use + g_file_open_tmp() (just added to GLib) instead of mkstemp() (or + mktemp() and open()). + + * io-xpm.c (gdk_pixbuf__xpm_image_begin_load): Ditto. + 2000-11-01 Havoc Pennington * gdk-pixbuf.c (gdk_pixbuf_new_subpixbuf): New function to create diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c index 6157147427..08fe3bc4af 100644 --- a/gdk-pixbuf/io-tiff.c +++ b/gdk-pixbuf/io-tiff.c @@ -153,26 +153,15 @@ gdk_pixbuf__tiff_image_begin_load (ModulePreparedNotifyFunc prepare_func, { TiffData *context; gint fd; - gchar *tmp = g_get_tmp_dir (); context = g_new (TiffData, 1); context->prepare_func = prepare_func; context->update_func = update_func; context->user_data = user_data; context->all_okay = TRUE; - context->tempname = - g_strconcat (tmp, - tmp[strlen (tmp)] == G_DIR_SEPARATOR ? G_DIR_SEPARATOR_S : "", - "gdkpixbuf-tif-tmp.XXXXXX", - NULL); -#ifdef HAVE_MKSTEMP - fd = mkstemp (context->tempname); -#else - mktemp (context->tempname); - fd = open (context->tempname, O_RDWR); -#endif + fd = g_file_open_tmp ("gdkpixbuf-tif-tmp.XXXXXX", &context->tempname, + NULL); if (fd < 0) { - g_free (context->tempname); g_free (context); return NULL; } diff --git a/gdk-pixbuf/io-xpm.c b/gdk-pixbuf/io-xpm.c index b762c87054..df561498f8 100644 --- a/gdk-pixbuf/io-xpm.c +++ b/gdk-pixbuf/io-xpm.c @@ -1413,10 +1413,9 @@ gdk_pixbuf__xpm_image_begin_load (ModulePreparedNotifyFunc prepare_func, context->update_func = update_func; context->user_data = user_data; context->all_okay = TRUE; - context->tempname = g_strdup ("/tmp/gdkpixbuf-xpm-tmp.XXXXXX"); - fd = mkstemp (context->tempname); + fd = g_file_open_tmp ("gdkpixbuf-xpm-tmp.XXXXXX", &context->tempname, + NULL); if (fd < 0) { - g_free (context->tempname); g_free (context); return NULL; } -- 2.30.2